import os
from langchain.chains import LLMChain
from langchain import PromptTemplate
from langchain.llms import OpenAI

os.environ["OPENAI_API_KEY"] = '读者申请的OpenAI API Key'
template = """Write a {adjective} poem about {subject}."""
prompt = PromptTemplate(template=template, input_variables=["adjective", "subject"])
llm_chain = LLMChain(prompt=prompt, llm=OpenAI(temperature=0), verbose=True)
llm_chain.predict(adjective="sad", subject="ducks")
